package com.biz.primus.common.utils;

import org.springframework.web.client.RestTemplate;

/**
 * @author david-liu
 * @date 2016年09月12日
 * @reviewer
 * @see
 */
public class BaiduMapUtil {

    public static String getLocationDecode(Double latitude, Double longitude) {
        RestTemplate restTemplate = new RestTemplate();
        String requestUrl = String.format(BaiduMapConfig.LOCATION_DECODE_URL, latitude, longitude, BaiduMapConfig.BAIDU_MAP_AK);
        return restTemplate.getForObject(requestUrl, String.class);
    }
    public static String getLocationEncode(String address) {
        RestTemplate restTemplate = new RestTemplate();
        String requestUrl = String.format(BaiduMapConfig.LOCATION_ENCODE_URL, address, BaiduMapConfig.BAIDU_MAP_AK);
        return restTemplate.getForObject(requestUrl, String.class);
    }
}
